<template>
	<cu-custom :customStyle="{backgroundColor:'white',backgroundImage:'linear-gradient(45deg, #caff005e, #ff810073)'}" :isBack="false" :paddingHeight="80">
		<template #content>
			<view style="color:#555">我的项目</view>
		</template>
	</cu-custom>
	<view>
		<view @click="onAddProject" style="margin:10px;justify-content: center;align-items:center;display: flex;padding: 20px 10px;height: 30px;border: solid 1rpx #dadada;border-radius: 5px;">
			<u-icon name="plus" size="18" :customStyle="{paddingRight:'3px'}"></u-icon> 添加项目2
		</view>
		
		<view @click="onClickProject(project,index)" v-for="(project,index) in projects" 
			style="margin:10px;padding:20px 10px;background-color: white;border-radius:5px;box-shadow: 0 0 6px 0 #77777777;"
		>
			<view style="display: flex;justify-content: space-between;align-items: center;">
				<view>
					<view style="font-weight: bold;">
						{{project.title}}
					</view>
					<view style="color: #999;">
						任务数量:{{project.task_count}}
					</view>
				</view>
				<view>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			
			<!-- 添加岗位按钮 -->
<!-- 			<view style="display: flex;justify-content: space-between;padding: 10px 10px 0px;">
				<view @click="onAddJob" style="justify-content: center;align-items:center;display: flex;padding: 5px 10px;height: 30px;border: solid 1rpx #dadada;border-radius: 5px;">
					<u-icon name="plus" size="18" :customStyle="{paddingRight:'3px'}"></u-icon> 添加岗位
				</view>
				<view @click="onOrganize(project)" style="justify-content: center;align-items:center;display: flex;padding: 5px 10px;height: 30px;border: solid 1rpx #dadada;border-radius: 5px;">
					 组织管理
				</view>
			</view> -->
			
		</view>
	</view>

	<!-- 列表衬底 --> 
	
	<view style="height: 55px;"></view>
	 
	<!-- 底部导航条 -->
	<tabbs></tabbs>
</template>
   
<script>
	import tabbs from '@/pages/tabbs/tabbas.vue'
	
	export default {
		components:{tabbs},
		data() {
			return {
				projects:[]
			}
		},
		onShow(){
			
			let that = this
			
			this.$nextTick( async ()=>{
				
				let res = await that.$http.get('/manager/job/project/list')
			
				console.log(res)
				
				that.projects = res.data
			})
		},
		methods: {
			onClickProject(project,index){
				this.pageParam.project = project
				uni.navigateTo({
					url:'/pages/job/publish/job-tasks/job-tasks'
				})
			},
			onAddProject(){
				// this.$http.post('/manager/job/project/create',{
				// 		title:'A'
				// })
				
				uni.navigateTo({
					url:'/pages/job/publish/job-projects/job-project-edit'
				})
				
			}
		}
	}
</script>

<style scoped>
	page {
		background-color: white;
	}
</style>
